#ifndef __MISC_H__
#define __MISC_H__

#include <Windows.h>
#include <stdlib.h>
#include <stdio.h>

static BYTE bCrossCursor[256] = {
	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
	0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF,
	0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF,
	0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0x00, 0x00, 0x01, 0xFF,
	0x00, 0x00, 0x01, 0xFF, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF,
	0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF,
	0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
	0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
	0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0xFF, 0xD7, 0xFE, 0x00,
	0x00, 0x28, 0x00, 0x00, 0xFF, 0xD7, 0xFE, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
	0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
	0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
};

typedef struct _SCREENSEL{
	INT     nResult;
	RECT    rc;
	RECT    rcSelect;
	RECT    rcScreen;
	HCURSOR hcrCross;
	HPEN    hpnBorder;
	HBITMAP hbmScreen;
	HDC     hdcScreen;
	INT     ndcScreen;
	HBITMAP hbmMem;
	HDC     hdcMem;
	INT     ndcMem;
	BOOL    bSave;
} SCREENSEL;

struct screenshot_t{
	int x;
	int y;
	int width;
	int height;
};

ATOM InitRegisterClass(HINSTANCE hInstance, LPCWSTR szWindowClass, SCREENSEL* pScrSelect);
BOOL InitInstance(HINSTANCE hInstance, LPCWSTR szWindowClass, int nCmdShow, SCREENSEL* pScrSelect);
LRESULT WINAPI SelectionProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
DWORD TakeScreenshot(LPVOID lParam);
BOOL Save_bmp(HBITMAP hBitmap, HDC hdc, int width, int height);
BOOL Copy_bmp(HBITMAP hBitmap);



#endif